include $(top_srcdir)/coverage.mk

SUBDIRS = inc src

if ENABLE_TESTS
SUBDIRS += qa
endif

ACLOCAL_AMFLAGS = -I m4

pkgconfig_DATA = \
		  libcmis-@LIBCMIS_API_VERSION@.pc \
		  libcmis-c-@LIBCMIS_API_VERSION@.pc
pkgconfigdir = $(libdir)/pkgconfig

if ENABLE_MAN
cmis-client.1: doc/cmis-client.xml
	$(DOCBOOK2MAN) $<

man_MANS = cmis-client.1
endif

EXTRA_DIST = \
	libcmis.pc.in \
	libcmis-c.pc.in \
	COPYING.MPL \
	COPYING.GPL \
	COPYING.LGPL \
	doc/cmis-client.xml.in \
	cppcheck-suppress \
	qa/libcmis/data

DISTCLEANFILES = \
	cmis-client.1 \
	libcmis-@LIBCMIS_API_VERSION@.pc \
	libcmis-c-@LIBCMIS_API_VERSION@.pc

dist-hook:
	@if test -d "$(srcdir)/.git"; \
	then \
		echo Creating ChangeLog && \
		( cd "$(top_srcdir)" && \
		  echo '# Generated by Makefile. Do not edit.'; echo; \
		  $(top_srcdir)/missing --run git log --pretty=medium ) > ChangeLog.tmp \
		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
		|| ( rm -f ChangeLog.tmp ; \
		     echo Failed to generate ChangeLog >&2 ); \
	else \
		echo A git clone is required to generate a ChangeLog >&2; \
	fi

cppcheck:
	@CPPCHECK@ -q --enable=style,performance,portability \
		-j @CPPCHECK_PARALLELISM@ \
		--suppressions-list=@SRCDIR@/cppcheck-suppress \
		--error-exitcode=1 @SRCDIR@
